// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App'
import router from './router'
import Tools from './assets/tools/Tools'
import store from './store'
var proxyMiddleware = require('http-proxy-middleware')
var config = require('../config')
var proxyTable = config.dev.proxyTable
console.log(proxyTable)

// proxy api requests  Object.keys(obj)  获取属性数组
Object.keys(proxyTable).forEach(function (context) {
  var options = proxyTable[context]
  if (typeof options === 'string') {
    options = { target: options }
  }
  proxyMiddleware(options.filter || context, options)
})
Vue.use(ElementUI)

Vue.config.productionTip = false
Vue.prototype.Tools = Tools

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
